package com.wlyuan.index.domain.index;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.collections4.CollectionUtils;

import java.util.List;
import java.util.stream.Stream;

/**
 * @author yuanjie
 */
@Getter
@AllArgsConstructor
public class CombineIndexScroll {
    private String scrollId;
    private Long total;
    private List<CombineIndex> indices;

    public Stream<CombineIndex> stream() {
        if (null == indices) {
            return Stream.empty();
        }
        return this.indices.stream();
    }

    public long size() {
        if (CollectionUtils.isEmpty(indices)) {
            return 0;
        }
        return this.indices.size();
    }
}
